/// @tags:
#include <cstdio>
#include <iostream>

using namespace std;

namespace BlueQuantum {

typedef long long LL;

constexpr int MAXN = 2e2 + 5;

int m;
int C[MAXN][MAXN];

inline int inc(int a, int b) {
  a += b;
  return a >= m ? a - m : a;
}

inline int main() {
  int n, d, m;
  cin >> n >> d >> m;
  C[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    C[i][0] = 1;
    for (int j = 1; j <= i; ++j) {
      C[i][j] = inc(C[i - 1][j], C[i - 1][j - 1]);
    }
  }
  if (d == n - 1) {
    cout << inc(C[n - 1][2] * 4LL % m, (n - 1) * 8LL % m);
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("make.in", "r", stdin);
  freopen("make.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
